package com.honglang.module.user.service;

import org.springframework.transaction.annotation.Transactional;

import com.honglang.module.user.entity.User;

@Transactional(readOnly = true)
public interface UserService {
	
	/**
	 *  Save User
	 * @param user
	 * @return
	 */
	@Transactional(readOnly = false)
	public User saveUser(User user);
	
	
	/**
	 * To check the username is exist or not?
	 * @param userName
	 * @return
	 */
	@Transactional(readOnly = true)
	public boolean isUserNameExist(String userName);
	
	
	/**
	 * To check the email is exist or not?
	 * @param userName
	 * @return
	 */
	@Transactional(readOnly = true)
	public boolean isEmailExist(String email);
	
	
	/**
	 * is user exist
	 * @param user
	 * @return
	 */
	@Transactional(readOnly = true)
	public boolean isUserExist(User user);
	
	
	/**
	 * Get the user by username;
	 * @param userName
	 * @return
	 */
	@Transactional(readOnly = true)
	public User getUserByUserName(String userName);
	

	/**
	 * validate the user;
	 * @param user
	 * @return
	 */
	@Transactional(readOnly = true)
	public boolean validateUser(User user);
	
	/**
	 * get User by username and email
	 * @param username
	 * @param email
	 * @return
	 */
	@Transactional(readOnly = true)
	public User getUserByNameAndEmail(String username,String email);
	
	/**
	 * reset user password ,and send it to user email;
	 * @param user
	 */
	@Transactional(readOnly = false)
	public String sendPassword(User user);
	
	
}
